import request from "@/utils/request";

export default class {
  /*分页获取视频列表*/
  static getVideoList(params) {
    return request({
      url: "/video",
      method: "get",
      params,
    });
  }

  /*获取子类分类*/
  static getVideoType(id) {
    return request({
      url: "/video/type/" + id,
      method: "get",
    });
  }

  /* 判断是否为叶子节点 */
  static judgeIsLeaf(id) {
    return request({
      url: "/video/type/isLeaf/" + id,
      method: "get",
    });
  }

  /*创建视频*/
  static createVideo(data) {
    return request({
      url: "/video",
      data,
      method: "POST",
    });
  }

  /*根据Id获取视频*/
  static getVideoById(id) {
    return request({
      url: "/video/" + id,
      method: "get",
    });
  }

  /*点赞视频*/
  static publishVideoLike(data) {
    return request({
      url: "/video/like",
      method: "post",
      data,
    });
  }

  /*收藏视频*/
  static publishVideoEnshrine(data) {
    return request({
      url: "/video/enshrine",
      method: "post",
      data,
    });
  }

  /*获取详细信息的分类*/
  static getDetailTypeInfo() {
    return request({
      url: "/video/typeWithVideo",
      method: "get",
    });
  }

  static getDetailTypeInfoById({id, ...params}) {
    return request({
      url: "/video/typeWithVideo/" + id,
      method: "get",
      params
    });
  }
}
